#include "stdafx.h"
#include "Device.h"


CDevice* CDevice::m_pInstance = NULL;

CDevice::CDevice()
{
	m_irrFileSystem = NULL;
	m_irrDriver = NULL;
	m_irrSceneManager = NULL;
	m_irrDevice = NULL;

	Initialize();
	InitializeFileSystem();
}

CDevice::~CDevice()
{	
}


IFileSystem * CDevice::GetFileSystem()
{
	return m_irrFileSystem;
}

IVideoDriver * CDevice::GetVideoDriver()
{
	return m_irrDriver;
}

ISceneManager * CDevice::GetSceneManager()
{	
	return m_irrSceneManager;
}



IrrlichtDevice * CDevice::GetIrrlichtDevice()
{
	return m_irrDevice;
}


void CDevice::Initialize()
{
	m_irrDevice = createDevice( video::EDT_OGLES1, dimension2d<u32>(480, 320), 16, false, false, false, 0);	
	m_irrDriver = m_irrDevice->getVideoDriver();
	m_irrSceneManager = m_irrDevice->getSceneManager();
}



void CDevice::InitializeFileSystem()
{
	m_irrFileSystem = m_irrDevice->getFileSystem();
}

void CDevice::BeginScene()
{		
	m_irrDriver->beginScene(true, true, video::SColor(255, 0, 0, 0));
}

void CDevice::EndScene()
{
	m_irrDriver->endScene();	
}
